<extend name="Base/user"/>


<block name="main">

<div class="container">
    <div class="col-md-6 col-md-offset-3 bg-white login-wrap">
        <h1 class="h4 text-center login-title">登录账号</h1>
                <form method="post" role="form" id="user" target="formAjax" <if condition="$isverify"> verify="1" </if> action="{:U('User/login')}">
            <input type="hidden" name="ref" value="">
            <div class="form-group">
                <label><i class="icon icon-user"></i> 用户名</label>
                <input type="text" class="form-control" name="username" placeholder="输入用户名/邮箱">
            </div>
          
            <div class="form-group">
                <label for=""><i class="icon icon-lock"></i> 密码</label>
                <input type="password" class="form-control" name="password" placeholder="不少于 6 位">
            </div>
            <if condition="$isverify">
            <div class="form-group">
                <label><i class="icon icon-picture"></i> 验证码</label>
                <input type="text" class="form-control" id="verify" name="verify" placeholder="请输入下方的验证码" >
                <div class="mt10"><a id="reloadCaptcha" href="javascript:void(0)"><img class="verifyimg reloadverify" alt="点击切换" src="{:U('Home/Home/verify')}" alt="点击更换" title="点击更换" ></a></div>
            </div>
         </if>
         <div class="checkbox">
          <label>
            <input type="checkbox" name="remember" value="on">
            记住登陆状态
          </label>
        </div>
        {:hook('syncLogin')}
            <div class="form-group">
                <button type="submit" class="btn btn-primary btn-block btn-lg">登录</button>
            </div>
        </form>
    </div>


    <div class="text-center col-md-12 login-link">
        <a href="{:U('User/register')}">注册新账号</a>
        |
        <a href="{:U('Index/index')}">首页</a>
        |
        <a href="{:U('User/mi')}">找回密码</a>
    </div>
</div>

</block>
<block name="script">
<script>
$(function(){
	//刷新验证码
	
    $(".reloadverify").click(function(){
    	changeverify();
     });
   
});
function changeverify(){

	var verifyimg = $(".verifyimg").attr("src");
	 if( verifyimg.indexOf('?')>0){
         $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
     }else{
         $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
     }
}
</script>
</block>